#pragma  once
#include <iostream>
#include "cocos2d.h"

USING_NS_CC;
using namespace std;

class AudioMgr
{
public:

	AudioMgr();
	~AudioMgr();

	static AudioMgr* getInstance();
	void init();

	void LoadMusic(unsigned int id);
	void LoadEffect(unsigned int id);
	void PlayMusic(unsigned int id,bool loop = false);
	void PlayEffect(unsigned int id, bool loop = false,float pitch = 1.0f, float pan = 0.0f, float gain = 1.0f);
	void PauseMusic();
	void PauseEffect();
	void ResumeMusic();
	void ResumeEffect();

public:

	void setMusicOn(bool isopen);
	void setEffectOn(bool isopen);
	bool getMusicOn()
	{
		return _musicOpen;
	};
	bool getEffectOn()
	{
		return _effectOpen;
	};

	float	getMusicVolume();
	float getEffectVolume();
	void setMusicVolume(float volume);
	void setEffectVolume(float volume);

private:

	string getMusicDirWithID(unsigned int id);
	string getEffectDirWithID(unsigned int id);
	
	bool _musicOpen;
	bool _effectOpen;

};

